package com.gbs.flash.api.controller.shop;

import com.gbs.flash.bean.constant.factory.PageFactory;
import com.gbs.flash.bean.entity.shop.Address;
import com.gbs.flash.bean.vo.front.Rets;
import com.gbs.flash.service.shop.AddressService;
import com.gbs.flash.utils.factory.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "收货地址管理", tags = "商品订单管理")
@RestController
@RequestMapping("/shop/address")
public class AddressController {

    @Autowired
    private AddressService addressService;

    @ApiOperation("查询用户收货地址")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Object list(@RequestParam(required = false) Long idUser) {
        Page<Address> page = new PageFactory<Address>().defaultPage();
        page.addFilter("idUser", idUser);
        page = addressService.queryPage(page);
        return Rets.success(page);
    }
}
